package org.jeecg.modules.charge.mapper;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.entity.charge.ChargeBills;
import org.jeecg.entity.charge.ChargeInvoiceRequest;
import org.jeecg.modules.charge.entity.BwInvoiceEntity.BlueInvoiceDetailed;
import org.jeecg.modules.charge.entity.ChargeBillsOrder;
import org.jeecg.modules.charge.entity.VoucherInvoiceOffline;

import java.util.List;

/**
 * @Description: 发票记录
 * @Author: jeecg-boot
 * @Date:   2019-08-15
 * @Version: V1.0
 */
public interface ChargeInvoiceRequestMapper extends BaseMapper<org.jeecg.entity.charge.ChargeInvoiceRequest> {
    public List<org.jeecg.entity.charge.ChargeInvoiceRequest> listBySn(@Param("sn") String sn);
    //根据开票状态获取请求的发票请求流水号
    public List<ChargeInvoiceRequest> getFpqqlsh();
    //根据房间ID获取对应项目的offceid
    public String getOidByRid(@Param("roomid") String roomid,@Param("type") String type);
    //回调成功后
    @SqlParser(filter = true)
    public org.jeecg.entity.charge.ChargeInvoiceRequest getDetailByLsh(@Param("fpqqlsh") String fpqqlsh);
    //防止重复回调调用，需要再插入前查询对应的订单号
    public String selectByOrderNum(@Param("ordernum") String ordernum);
    //更新开票失败的发票
    public void updatefail(@Param("detail") String detail,@Param("fpqqlsh") String fpqqlsh);
    //根据房间ID获取之前开过的企业票填写的内容
    public org.jeecg.entity.charge.ChargeInvoiceRequest getHisMakeInvoiceInfo(@Param("roomid") String roomid);
    //根据房间ID获取最后一个缴费应收账单
    public String getPayLastBills(@Param("roomid") String roomid);
    //根据订单号查询到对应的账单信息
    public org.jeecg.entity.charge.ChargeInvoiceRequest getInfoByOrder(@Param("ordernum") String ordernum);
    //根据用户ID获取对应的已认证的房产ID
    public List<String> getRoomIdsByUid(@Param("uid") String uid);
    //根据用户绑定房间ID获取到对应的缴费记录
    public List<org.jeecg.entity.charge.ChargeInvoiceRequest> getDetailsByRids(@Param("roomids") List<String> roomids);
    //根据对应的发票号码和代码查询对应的PDF地址
    public String getPdfByhm(@Param("fphm") String fphm,@Param("fpdm") String fpdm);
    //根据流水号更新返回开票信息
    public Integer updateResByfplsh(@Param("fpqqlsh") String fpqqlsh,@Param("res") String res);
    //根据封账状态5且和日期轮训开具封账状态的发票
    public List<org.jeecg.entity.charge.ChargeInvoiceRequest> getDetailsSelStatus(@Param("dateStr") String dateStr);
    //根据发票请求流水号删除请求记录，再重新插入
    public Integer deleteDetailByLsh(@Param("fpqqlsh") String fpqqlsh);
    //根据房间ID获取对应的账单对象
    public List<ChargeBills> getBillsByRoomId(@Param("roomId") String roomId);
    //根据公司ID获取对应的公司名称
    public String getComNameById(@Param("comId") String comId);
    //根据pid获取NC系统对应的项目编号
    public String getVouItemByPid(@Param("pId") String pId);
    //根据房间ID获取对应的最后一个月缴费年月
    public String getLastPayCnyByRoomId(@Param("roomId") String roomId);
    //根据时间段获取对应为生成凭证的发票
    public List<VoucherInvoiceOffline> getDetailsNoVouRecordByDate(@Param("kprqFrom") String kprqFrom, @Param("kprqTo")String kprqTo);
    //更新发票中对应的voucher_head_id
    public void updateVoucherHeadId(org.jeecg.entity.charge.ChargeInvoiceRequest invoice);
    //根据pid和rid获取对应的凭证头
    public String getVoucherItemByPidRid(@Param("pid") String pid,@Param("rid") String rid);
    //根据Pid 和cid(业主ID)获取对应的凭证头
    public String getVoucherItemByPidCid(@Param("pid") String pid,@Param("cid") String cid);
    //根据房间ID获取对应的房间属性
    public String getRoomProperty(@Param("rid") String rid);
    //根据业主ID获取对应房间的房间属性
    public String getRoomPeopertyByCid(@Param("cid") String cid);
    //根据类型获取对应的账单
    public List<ChargeBills>  getBillsByRoomIdType(@Param("roomId") String roomId, @Param("type") String type);
    public List<ChargeBillsOrder> getOrders();
    //根据收款方式获取对应的计税合计的科目编号
    public String  getSubCodeByMethod(@Param("method") String method);
    //前端销账接口。
    public Integer updateBillsByIds(@Param("billIds") List<String> billIds, @Param("skrq") String skrq, @Param("method") String method);

    public Integer addRequestInfo(BlueInvoiceDetailed detail);
//查询
    public Integer getCountByComName(@Param("kprqFrom") String kprqFrom, @Param("kprqTo")String kprqTo,@Param("company")String company);

    public List<BlueInvoiceDetailed> getInvoiceRequestInfo(@Param("invoiceReqId") String invoiceReqId);

    public org.jeecg.entity.charge.ChargeInvoiceRequest getInfoByFpqqlsh(@Param("fpqqlsh") String fpqqlsh);

    List<ChargeInvoiceRequest> findPage(@Param("page") Page<ChargeInvoiceRequest> page,@Param("invoiceRequest") ChargeInvoiceRequest invoiceRequest);
}
